import Vue from 'vue'
import VueRouter from 'vue-router'
import navData from '@/utils/navData'
Vue.use(VueRouter)

// const routes = [
//   {
//     path: '/',
//     component: () => import('../views/rightMain/content/Home.vue')
//   },
//   {
//     path: '/home',
//     name: 'home',
//     meta: { title: '首页' },
//     component: () => import('../views/rightMain/content/Home.vue')
//   },
//   {
//     path: '/testA',
//     name: 'testA',
//     component: () => import('../views/rightMain/content/TestA.vue')
//   },
//   {
//     path: '/testB',
//     name: 'testB',
//     component: () => import('../views/rightMain/content/TestB.vue')
//   }
// ]
// let routes = [];
const routes = [
  {
    path: '/',
    redirect:'/home'
  },
];
//根据数据动态生成路由
navData.forEach(item => {
  routes.push({
    path: item.path,
    name: item.name,
    meta: { title: item.title },
    component: () => import( '../views/rightMain/content/'+item.component)
  },)
})

const router = new VueRouter({
  linkActiveClass:'selected',
  routes
})

export default router



